package com.netvine.iias;

import com.netsdk.lib.NetSDKLib;

public enum DaHuaCommand {
    UP(NetSDKLib.NET_PTZ_ControlType.NET_PTZ_UP_CONTROL),
    DOWN(NetSDKLib.NET_PTZ_ControlType.NET_PTZ_DOWN_CONTROL),
    LEFT(NetSDKLib.NET_PTZ_ControlType.NET_PTZ_LEFT_CONTROL),
    RIGHT(NetSDKLib.NET_PTZ_ControlType.NET_PTZ_RIGHT_CONTROL),
    UPLEFT(NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTTOP),
    UPRIGHT(NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTTOP),
    DOWNLEFT(NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_LEFTDOWN),
    DOWNRIGHT(NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_RIGHTDOWN),
    ZOOMIN(NetSDKLib.NET_PTZ_ControlType.NET_PTZ_ZOOM_ADD_CONTROL),
    ZOOMOUT(NetSDKLib.NET_PTZ_ControlType.NET_PTZ_ZOOM_DEC_CONTROL),
    SETPRESET(NetSDKLib.NET_PTZ_ControlType.NET_PTZ_POINT_SET_CONTROL),
    GOTOPRESET(NetSDKLib.NET_PTZ_ControlType.NET_PTZ_POINT_MOVE_CONTROL);

    private final int commandCode;

    DaHuaCommand(int commandCode) {
        this.commandCode = commandCode;
    }

    public int getCommandCode() {
        return commandCode;
    }

    public static int getDaHuaCommand(String command) {
        try {
            return DaHuaCommand.valueOf(command).getCommandCode();
        } catch (IllegalArgumentException e) {
            return -1; // 如果命令无效，返回 -1
        }
    }
}
